package org.opentcs.kcvehicle.communication.kc.udp.Service;

import org.opentcs.kcvehicle.communication.kc.udp.agv.param.AgvEvent;
import org.opentcs.kcvehicle.communication.kc.udp.agv.param.AgvEventConstant;
import org.opentcs.kcvehicle.communication.kc.udp.agv.param.rsp.RcvEventPackage;
import org.opentcs.kcvehicle.communication.kc.udp.io.UDPClient;

public class ConfirmRelocation
    extends
      BaseCommand {

  /**
   * decs: 确认机器人位置.
   * 指令：0x1F.
   * author: caixiang.
   * date: 2025/1/17 16:25.
   */
  public static AgvEvent confirmInitialPosition() {
    AgvEvent agvEvent = new AgvEvent(AgvEventConstant.CommandCode_CONFIRM_ROBOT_POSITION);
    return agvEvent;
  }

  public static void commnd() {
    //0x1F(确认初始位置)
    AgvEvent agvEvent = confirmInitialPosition();
    printInfo(agvEvent);
    RcvEventPackage rcv = UDPClient.localAGV.send(agvEvent);
    if (rcv.isOk()) {
      System.out.println("0x1F ok");
    }
    else {
      System.out.println();
      System.out.println("0x1F fail");
      System.out.println("received transationId : " + "isok:" + rcv.isOk());
    }
  }
}
